// See http://docs.sequelizejs.com/en/latest/docs/models-definition/
// for more of what you can do here.
const Sequelize = require('sequelize');
const DataTypes = Sequelize.DataTypes;

module.exports = function (app) {
  const sequelizeClient = app.get('sequelizeClient');
  const symbols = sequelizeClient.define('symbols', {
    symbol_id: {
      type: DataTypes.STRING,
      primaryKey: true,
      allowNull: false
    },
    exchange_id: {
      type: DataTypes.STRING,
    },
    symbol_type: {
      type: DataTypes.STRING,
    },
    asset_id_base: {
      type: DataTypes.STRING,
    },
    asset_id_quote: {
      type: DataTypes.STRING,
    },
    data_start: {
      type: DataTypes.DATE,
    },
    data_end: {
      type: DataTypes.DATE,
    },
    volume_1hrs: {
      type: DataTypes.FLOAT,
    },
    volume_1hrs_usd: {
      type: DataTypes.FLOAT,
    },
    volume_1day: {
      type: DataTypes.FLOAT,
    },
    volume_1day_usd: {
      type: DataTypes.FLOAT,
    },
    volume_1mth: {
      type: DataTypes.FLOAT,
    },
    volume_1mth_usd: {
      type: DataTypes.FLOAT,
    },
    isShow: {
      type: DataTypes.BOOLEAN,
      defaultValue: false
    }
  }, {
    timestamps: false,
    hooks: {
      beforeCount(options) {
        options.raw = true;
      }
    }
  });

  // eslint-disable-next-line no-unused-vars
  symbols.associate = function (models) {
    // Define associations here
    // See http://docs.sequelizejs.com/en/latest/docs/associations/
  };

  return symbols;
};
